<?php

namespace App\Models;

use Moell\Mojito\Models\AdminUser as MojitoAdminUser;

class AdminUser extends MojitoAdminUser
{
    protected $fillable = [
        'name', 'email', 'password', 'pid',
    ];

    public function subUser()
    {
        return $this->hasMany(self::class, 'pid', 'id');
    }

    protected function getSubUserIds($id)
    {
        return $this->where('pid', $id)
            ->select('id')
            ->get()
            ->pluck('id')->toArray();
    }
}
